<layout name='Layout/layout_main' />
<script type="text/javascript">
	function mark(action){
		var vars = $("#form_data").serialize();
		switch(action) {
			case "del":
				if(confirm('确定要删除吗?')){
					sendAjax("{:U('Doc/mark?action=del')}", vars, function(data) {
						if (data.status) {
							alert(data.info);
							$("input[name='doc_id[]']:checkbox:checked").each(function() {
								$(this).parents("li").remove();
							})
						}
					});
				}
				break;
			default:
		}
		$("#select_all").attr("checked", false);
	}

	function add() {
		window.open("{:U('add?fid='.$folder_id)}", "_self");
	}

	function move_to(val) {
		var vars = $("#form_data").serialize();
		sendAjax("{:U('mark?action=move_folder')}", 'val=' + val + '&' + vars);
		$("input[name='doc_id[]']:checkbox:checked").each(function() {
			$(this).parent().parent().hide();
		})
	}

	$(document).ready(function(){
		set_return_url();
		$(".input-date").datepicker();
		
		$("#move_to li").click(function(){
			move_to($(this).attr("id"));
		})
	}); 
</script>
<div class="doc">
	<form id="form_search" method='post' >
		<input type="hidden" name="fid" id="fid" value={$folder_id}>
		<div class="row-fluid title">
			<span>{$folder_name}</span>
			<div class="input-append right">
				<input type="text"  onkeydown="key_search();" name="keyword">
				<a class="btn" type="button" onclick="btn_search();"> <i class="icon-search"></i>
				</a>
				<a class="btn" onclick="open_search();"> <i class="icon-angle-down"></i>
				</a>
			</div>
		</div>
		<div class="row-fluid adv_search">
			<div class="row-fluid adv_search_head">
				<h4 class="left">高级搜索</h4>
				<div class="right text-right">
					<a  class="btn" onclick="adv_search();">搜索</a>
					<a  class="btn" onclick="close_search();">关闭</a>
				</div>
			</div>
			<div class="row-fluid form-horizontal">
				<div class="control-group span6">
					<label class="control-label" for="li_name">文件名：</label>
					<div class="controls">
						<input type="text" id="li_name" name="li_name"></div>
				</div>
				<div class="control-group span6">
					<label class="control-label" for="li_content">内容：</label>
					<div class="controls">
						<input type="text" id="li_content" name="li_content" ></div>
				</div>
			</div>
			<div class="row-fluid form-horizontal">
				<div class="control-group span6">
					<label class="control-label" for="eq_user_name">登录人：</label>
					<div class="controls">
						<input type="text" id="eq_user_name" name="eq_user_name"></div>
				</div>
				<div class="control-group span6">
					<label class="control-label" for="be_create_time">登录时间：</label>
					<div class="controls">
						<input  type="text" name="be_create_time" id="be_create_time" class="input-date" value=""  readonly="readonly">
						&nbsp;~&nbsp;
						<input type="text" name="en_create_time" id="en_create_time" value="" readonly="readonly" class="input-date" ></div>
				</div>
			</div>
			<div class="row-fluid form-horizontal">
				<div class="control-group span6">
					<label class="control-label" for="tag">分类：</label>
					<div class="controls">
						<input type="text" id="tag" name="tag" ></div>
				</div>
			</div>
		</div>
	</form>
	<div class="row-fluid operate">
		<div class="left">
			<if condition="$auth['admin']">
				<a class="btn" onclick="mark('del');">删除</a>
				<div class="btn-group" id="move_to">
					<a class="btn dropdown-toggle" data-toggle="dropdown" href="#" >
						转移到
						<span class="caret"></span>
					</a>
					<ul class="dropdown-menu">{$folder_list}</ul>
				</div>
			</if>
		</div>
		<div class="right">
			<if condition="$auth['write']">
				<a class="btn" onclick="add()">新建</a>
			</if>
		</div>
	</div>
	<form method="post" action="" id="form_data">
		<div class="table">
			<ul>
				<li class="thead" style="padding-left:30px;">
					<span class="checkbox">
						<input  type="checkbox" id="chk_select_all" value="all" onclick="select_all('doc_id[]')"/>						
					</span>
					<span class="col-12">编号</span>
					<span class="col-20">分类</span>
					<span class="col-9 right hidden-phone">修改时间</span>
					<span class="col-9 right">登录时间</span>
					<span class="col-6 right">登录人</span>
					<div class="auto autocut">文件名</div>
				</li>
			<if condition="count($list) eq 0 ">
				<li class="tbody text-center">
					<h3>没找到相应的数据</h3>
				</li>
			</ul>
		</div>
	</form>				
			<else/>
			<foreach name="list" item="vo">
				<li class="tbody" style="padding-left:30px">
					<span class="checkbox">
						<input  type="checkbox" name="doc_id[]" value="{$vo.id}" />
					</span>
					<span class="col-12 text-center">						
						<div class="wrap">{$vo.doc_no}</div>
					</span>
					<span class="autocut col-20 text-center ">						
						{$vo.tag_name}
					</span>
					<span class="col-9 right text-center hidden-phone">&nbsp;{$vo.update_time|toDate='Y-m-d'}&nbsp;</span>
					<span class="col-9 right text-center">&nbsp;{$vo.create_time|toDate='Y-m-d'}&nbsp;</span>
					<span class="col-6 right text-center">{$vo.user_name}</span>
					<div class="auto autocut">
						<a href="{:U('read?id='.$vo['id'])}">
							{$vo.name}
							<span class="sort_content">
								<eq name="vo.name|strlen" value="0">无标题</eq>
							</span>
						</a>
					</div>
				</li>
			</foreach>
			</ul>
		</div>
	</form>
	<div class="page">{$page}</div>
</if>
</div>